var t = getApp();

Page({
    data: {
        commodityTitle: "",
        historydata: []
    },
    onLoad: function(t) {
        this.getHistory();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    onShareTimeline: function() {},
    getHistory: function() {
        var i = this, o = t.getNetAddresss("plugin.micro-communities.api.index.getSearch");
        t._postNetWork({
            url: o,
            showToastIn: !1,
            data: {},
            success: function(t) {
                var o = t.data;
                1 == o.result ? i.setData({
                    historydata: o.data.data
                }) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {}
        });
    },
    goToSearch: function() {
        wx.navigateTo({
            url: "/packageC/micro_communities/microClassification/microClassification?searchdata=" + this.data.commodityTitle
        });
    },
    clearHistory: function() {
        var i = this, o = t.getNetAddresss("plugin.micro-communities.api.trick.delSearch");
        t._postNetWork({
            url: o,
            showToastIn: !1,
            data: {},
            success: function(t) {
                var o = t.data;
                1 == o.result ? (i.setData({
                    historydata: []
                }), wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                })) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {}
        });
    },
    goHistoryBtn: function(t) {
        wx.navigateTo({
            url: "/packageC/micro_communities/microClassification/microClassification?searchdata=" + this.data.val
        });
    },
    commodityTitleInp: function(t) {
        var i = t.detail.value;
        this.setData({
            commodityTitle: i
        });
    },
    commodityTitleClear: function() {
        this.setData({
            commodityTitle: ""
        });
    }
});